import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
 /* {
    title: '创建人',
    align: "center",
    dataIndex: 'userId_dictText'
  },*/
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '订单状态',
    align: "center",
    dataIndex: 'waybillStatus_dictText'
  },
  {
    title: '运单号',
    align: "center",
    dataIndex: 'waybillNo'
  },
  {
    title: '提货时间',
    align: "center",
    dataIndex: 'deliveryTime'
  },
  {
    title: '预计送达时间',
    align: "center",
    dataIndex: 'estArrivalTime'
  },
  {
    title: '发货人姓名',
    align: "center",
    dataIndex: 'shipperName'
  },
  {
    title: '发货人电话',
    align: "center",
    dataIndex: 'shipperPhone'
  },
  {
    title: '发货人证件号',
    align: "center",
    dataIndex: 'shipperIdNum'
  },
  {
    title: '发货人地区编码',
    align: "center",
    dataIndex: 'shipperAreaCode',
  },
  {
    title: '发货人地区名称',
    align: "center",
    dataIndex: 'shipperAreaName'
  },
  {
    title: '发货人详细地址',
    align: "center",
    dataIndex: 'shipperDetailAddr'
  },
  {
    title: '发货方经纬度',
    align: "center",
    dataIndex: 'shipperLnglat'
  },
  {
    title: '收货方姓名',
    align: "center",
    dataIndex: 'consignerName'
  },
  {
    title: '收货方电话',
    align: "center",
    dataIndex: 'consignerPhone'
  },
  {
    title: '收件方证件号',
    align: "center",
    dataIndex: 'consignerIdNum'
  },
  {
    title: '收货方地区编码',
    align: "center",
    dataIndex: 'consignerAreaCode',
  },
  {
    title: '收货方地区名称',
    align: "center",
    dataIndex: 'consignerAreaName'
  },
  {
    title: '收货方详细地址',
    align: "center",
    dataIndex: 'consignerDetailAddr'
  },
  {
    title: '收货方经纬度',
    align: "center",
    dataIndex: 'consignerLnglat'
  },
  {
    title: '货物名称',
    align: "center",
    dataIndex: 'cargoName'
  },
  {
    title: '货物件数',
    align: "center",
    dataIndex: 'cargoPieces'
  },
  {
    title: '货物重量',
    align: "center",
    dataIndex: 'cargoWeight'
  },
  {
    title: '货物体积',
    align: "center",
    dataIndex: 'cargoVolume'
  },
  {
    title: '货物价值',
    align: "center",
    dataIndex: 'cargoPrice'
  },
  {
    title: '货物备注',
    align: "center",
    dataIndex: 'cargoRemark'
  },
  {
    title: '代收款',
    align: "center",
    dataIndex: 'invoicingFee'
  },
  {
    title: '代收款支付方式',
    align: "center",
    dataIndex: 'invoicingPayMode_dictText'
  },
  {
    title: '是否收取代收款',
    align: "center",
    dataIndex: 'izInvoicingFee',
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'是',value:'1'},{text:'否',value:'0'}]);
     },
  },
  {
    title: '代收款订单号',
    align: "center",
    dataIndex: 'invoicingOrderNum'
  },
  {
    title: '实际代收款支付方式',
    align: "center",
    dataIndex: 'invoicingRealPayMode_dictText'
  },
  {
    title: '司机运费',
    align: "center",
    dataIndex: 'driverFreightFee'
  },
  {
    title: '结算运费状态',
    align: "center",
    dataIndex: 'settleFreightStatus',
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'是',value:'1'},{text:'否',value:'0'}]);
     },
  },
  {
    title: '运费结算时间',
    align: "center",
    dataIndex: 'settleFreightTime'
  },
  {
    title: '运费结算方式',
    align: "center",
    dataIndex: 'settleFreightMode'
  },
  {
    title: '是否指派司机',
    align: "center",
    dataIndex: 'izAssignDriver',
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'是',value:'1'},{text:'否',value:'0'}]);
     },
  },
  {
    title: '接单时间',
    align: "center",
    dataIndex: 'orderTime'
  },
  {
    title: '接单用户',
    align: "center",
    dataIndex: 'driverUserId_dictText'
  },
  {
    title: '司机车牌号',
    align: "center",
    dataIndex: 'driverVehicleNo'
  },
  {
    title: '司机电话',
    align: "center",
    dataIndex: 'driverPhone'
  },
  {
    title: '司机姓名',
    align: "center",
    dataIndex: 'driverName'
  },
  {
    title: '司机银行卡',
    align: "center",
    dataIndex: 'driverBankId'
  },
  {
    title: '司机银行开户名',
    align: "center",
    dataIndex: 'driverBankHolder'
  },
  {
    title: '司机银行卡号',
    align: "center",
    dataIndex: 'driverBankCardNo'
  },
  {
    title: '司机开户银行',
    align: "center",
    dataIndex: 'driverBankName'
  },
  {
    title: '浏览量',
    align: "center",
    dataIndex: 'scanNum'
  },
  {
    title: '评论量',
    align: "center",
    dataIndex: 'commentNum'
  },


];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "创建人",
    field: 'userId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "sys_user,realname,id"
    },
    //colProps: {span: 6},
  },
  {
    label: "提货时间",
    field: "deliveryTime",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    //colProps: {span: 6},
  },
  {
    label: "发货人姓名",
    field: 'shipperName',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "发货人电话",
    field: 'shipperPhone',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "发货人证件号",
    field: 'shipperIdNum',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "发货人地区编码",
    field: 'shipperAreaCode',
    component: 'JAreaLinkage',
    //colProps: {span: 6},
  },
  {
    label: "收货方姓名",
    field: 'consignerName',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "收货方电话",
    field: 'consignerPhone',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "收件方证件号",
    field: 'consignerIdNum',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "收货方地区编码",
    field: 'consignerAreaCode',
    component: 'JAreaLinkage',
    //colProps: {span: 6},
  },
  {
    label: "货物名称",
    field: 'cargoName',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "是否收取代收款",
    field: 'izInvoicingFee',
    component: 'JSwitch',
    componentProps:{
      options: "[1,0]"
    },
    //colProps: {span: 6},
  },
  {
    label: "代收款订单号",
    field: 'invoicingOrderNum',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "实际代收款支付方式",
    field: 'invoicingRealPayMode',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "pay_mode"
    },
    //colProps: {span: 6},
  },
  {
    label: "结算运费状态",
    field: 'settleFreightStatus',
    component: 'JSwitch',
    componentProps:{
      options: "[1,0]"
    },
    //colProps: {span: 6},
  },
  {
    label: "运费结算时间",
    field: 'settleFreightTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
    },
    //colProps: {span: 6},
  },
  {
    label: "接单用户",
    field: 'driverUserId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "sys_user,realname,id"
    },
    //colProps: {span: 6},
  },
  {
    label: "司机车牌号",
    field: 'driverVehicleNo',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "司机电话",
    field: 'driverPhone',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "司机姓名",
    field: 'driverName',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "司机银行卡",
    field: 'driverBankId',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "司机银行开户名",
    field: 'driverBankHolder',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "司机银行卡号",
    field: 'driverBankCardNo',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "司机开户银行",
    field: 'driverBankName',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "订单状态",
    field: 'waybillStatus',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "waybill_status"
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '创建人',
    field: 'userId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "sys_user,realname,id"
    },
  },
  {
    label: '运单号',
    field: 'waybillNo',
    component: 'Input',
  },
  {
    label: '提货时间',
    field: 'deliveryTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '预计送达时间',
    field: 'estArrivalTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '发货人姓名',
    field: 'shipperName',
    component: 'Input',
  },
  {
    label: '发货人电话',
    field: 'shipperPhone',
    component: 'Input',
  },
  {
    label: '发货人证件号',
    field: 'shipperIdNum',
    component: 'Input',
  },
  {
    label: '发货人地区编码',
    field: 'shipperAreaCode',
    component: 'JAreaLinkage',
  },
  {
    label: '发货人地区名称',
    field: 'shipperAreaName',
    component: 'Input',
  },
  {
    label: '发货人详细地址',
    field: 'shipperDetailAddr',
    component: 'InputTextArea',
  },
  {
    label: '发货方经纬度',
    field: 'shipperLnglat',
    component: 'Input',
  },
  {
    label: '收货方姓名',
    field: 'consignerName',
    component: 'Input',
  },
  {
    label: '收货方电话',
    field: 'consignerPhone',
    component: 'Input',
  },
  {
    label: '收件方证件号',
    field: 'consignerIdNum',
    component: 'Input',
  },
  {
    label: '收货方地区编码',
    field: 'consignerAreaCode',
    component: 'JAreaLinkage',
  },
  {
    label: '收货方地区名称',
    field: 'consignerAreaName',
    component: 'Input',
  },
  {
    label: '收货方详细地址',
    field: 'consignerDetailAddr',
    component: 'InputTextArea',
  },
  {
    label: '收货方经纬度',
    field: 'consignerLnglat',
    component: 'Input',
  },
  {
    label: '货物名称',
    field: 'cargoName',
    component: 'Input',
  },
  {
    label: '货物件数',
    field: 'cargoPieces',
    component: 'InputNumber',
  },
  {
    label: '货物重量',
    field: 'cargoWeight',
    component: 'InputNumber',
  },
  {
    label: '货物体积',
    field: 'cargoVolume',
    component: 'InputNumber',
  },
  {
    label: '货物价值',
    field: 'cargoPrice',
    component: 'InputNumber',
  },
  {
    label: '货物备注',
    field: 'cargoRemark',
    component: 'Input',
  },
  {
    label: '代收款',
    field: 'invoicingFee',
    component: 'InputNumber',
  },
  {
    label: '代收款支付方式',
    field: 'invoicingPayMode',
    component: 'JCheckbox',
    componentProps:{
        dictCode:"pay_mode"
     },
  },
  {
    label: '是否收取代收款',
    field: 'izInvoicingFee',
    component: 'JSwitch',
    componentProps:{
      options: [1,0]
    },
  },
  {
    label: '代收款订单号',
    field: 'invoicingOrderNum',
    component: 'Input',
  },
  {
    label: '实际代收款支付方式',
    field: 'invoicingRealPayMode',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "pay_mode"
    },
  },
  {
    label: '司机运费',
    field: 'driverFreightFee',
    component: 'InputNumber',
  },
  {
    label: '结算运费状态',
    field: 'settleFreightStatus',
    component: 'JSwitch',
    componentProps:{
      options: [1,0]
    },
  },
  {
    label: '运费结算时间',
    field: 'settleFreightTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '运费结算方式',
    field: 'settleFreightMode',
    component: 'Input',
  },
  {
    label: '是否指派司机',
    field: 'izAssignDriver',
    component: 'JSwitch',
    componentProps:{
      options: [1,0]
    },
  },
  {
    label: '接单时间',
    field: 'orderTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '接单用户',
    field: 'driverUserId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "sys_user,realname,id"
    },
  },
  {
    label: '司机车牌号',
    field: 'driverVehicleNo',
    component: 'Input',
  },
  {
    label: '司机电话',
    field: 'driverPhone',
    component: 'Input',
  },
  {
    label: '司机姓名',
    field: 'driverName',
    component: 'Input',
  },
  {
    label: '司机银行卡',
    field: 'driverBankId',
    component: 'Input',
  },
  {
    label: '司机银行开户名',
    field: 'driverBankHolder',
    component: 'Input',
  },
  {
    label: '司机银行卡号',
    field: 'driverBankCardNo',
    component: 'Input',
  },
  {
    label: '司机开户银行',
    field: 'driverBankName',
    component: 'Input',
  },
  {
    label: '浏览量',
    field: 'scanNum',
    component: 'InputNumber',
  },
  {
    label: '评论量',
    field: 'commentNum',
    component: 'Input',
  },
  {
    label: '订单状态',
    field: 'waybillStatus',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "waybill_status"
    },
  },
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "row_status"
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  userId: {title: '创建人',order: 0,view: 'sel_search', type: 'string',dictTable: "sys_user", dictCode: 'id', dictText: 'realname',},
  waybillNo: {title: '运单号',order: 1,view: 'text', type: 'string',},
  deliveryTime: {title: '提货时间',order: 2,view: 'datetime', type: 'string',},
  estArrivalTime: {title: '预计送达时间',order: 3,view: 'datetime', type: 'string',},
  shipperName: {title: '发货人姓名',order: 4,view: 'text', type: 'string',},
  shipperPhone: {title: '发货人电话',order: 5,view: 'text', type: 'string',},
  shipperIdNum: {title: '发货人证件号',order: 6,view: 'text', type: 'string',},
  shipperAreaCode: {title: '发货人地区编码',order: 7,view: 'pca', type: 'string',},
  shipperAreaName: {title: '发货人地区名称',order: 8,view: 'text', type: 'string',},
  shipperDetailAddr: {title: '发货人详细地址',order: 9,view: 'textarea', type: 'string',},
  shipperLnglat: {title: '发货方经纬度',order: 10,view: 'text', type: 'string',},
  consignerName: {title: '收货方姓名',order: 11,view: 'text', type: 'string',},
  consignerPhone: {title: '收货方电话',order: 12,view: 'text', type: 'string',},
  consignerIdNum: {title: '收件方证件号',order: 13,view: 'text', type: 'string',},
  consignerAreaCode: {title: '收货方地区编码',order: 14,view: 'pca', type: 'string',},
  consignerAreaName: {title: '收货方地区名称',order: 15,view: 'text', type: 'string',},
  consignerDetailAddr: {title: '收货方详细地址',order: 16,view: 'textarea', type: 'string',},
  consignerLnglat: {title: '收货方经纬度',order: 17,view: 'text', type: 'string',},
  cargoName: {title: '货物名称',order: 18,view: 'text', type: 'string',},
  cargoPieces: {title: '货物件数',order: 19,view: 'number', type: 'number',},
  cargoWeight: {title: '货物重量',order: 20,view: 'number', type: 'number',},
  cargoVolume: {title: '货物体积',order: 21,view: 'number', type: 'number',},
  cargoPrice: {title: '货物价值',order: 22,view: 'number', type: 'number',},
  cargoRemark: {title: '货物备注',order: 23,view: 'text', type: 'string',},
  invoicingFee: {title: '代收款',order: 24,view: 'number', type: 'number',},
  invoicingPayMode: {title: '代收款支付方式',order: 25,view: 'checkbox', type: 'string',dictCode: 'pay_mode',},
  izInvoicingFee: {title: '是否收取代收款',order: 26,view: 'number', type: 'number',},
  invoicingOrderNum: {title: '代收款订单号',order: 27,view: 'text', type: 'string',},
  invoicingRealPayMode: {title: '实际代收款支付方式',order: 28,view: 'list', type: 'string',dictCode: 'pay_mode',},
  driverFreightFee: {title: '司机运费',order: 29,view: 'number', type: 'number',},
  settleFreightStatus: {title: '结算运费状态',order: 30,view: 'number', type: 'number',},
  settleFreightTime: {title: '运费结算时间',order: 31,view: 'datetime', type: 'string',},
  settleFreightMode: {title: '运费结算方式',order: 32,view: 'text', type: 'string',},
  izAssignDriver: {title: '是否指派司机',order: 33,view: 'number', type: 'number',},
  orderTime: {title: '接单时间',order: 34,view: 'datetime', type: 'string',},
  driverUserId: {title: '接单用户',order: 35,view: 'sel_search', type: 'string',dictTable: "sys_user", dictCode: 'id', dictText: 'realname',},
  driverVehicleNo: {title: '司机车牌号',order: 36,view: 'text', type: 'string',},
  driverPhone: {title: '司机电话',order: 37,view: 'text', type: 'string',},
  driverName: {title: '司机姓名',order: 38,view: 'text', type: 'string',},
  driverBankId: {title: '司机银行卡',order: 39,view: 'text', type: 'string',},
  driverBankHolder: {title: '司机银行开户名',order: 40,view: 'text', type: 'string',},
  driverBankCardNo: {title: '司机银行卡号',order: 41,view: 'text', type: 'string',},
  driverBankName: {title: '司机开户银行',order: 42,view: 'text', type: 'string',},
  scanNum: {title: '浏览量',order: 43,view: 'number', type: 'number',},
  commentNum: {title: '评论量',order: 44,view: 'text', type: 'string',},
  waybillStatus: {title: '订单状态',order: 45,view: 'list', type: 'string',dictCode: 'waybill_status',},
  status: {title: '状态',order: 46,view: 'list', type: 'string',dictCode: 'row_status',},
};
